'use strict';
const 
myrouter = require('../routers'),
router = require('koa-router')();


// console.log(myrouter);
function a(){
        for(let f in myrouter){
        console.log(f);
        let key = myrouter[f][0];
        let tap = myrouter[f][1];
        // console.log(key);
        // console.log(tap);
        if(key==='get'){
            console.log(key);
            router.get(f,tap);
        }else if(key === 'post'){
            console.log(key);
            router.post(f,tap);
        }else{
            console.log('无用的路由'+f);
        }
    }
}





module.exports =function (){
    a();
    return router.routes();
}